package responses

const (
	Success             = 200 // 成功
	Fail                = 400 // 失败
	Unauthorized        = 401 // 未授权
	NotFound            = 404 // 接口不存在
	InternalServerError = 500 // 服务器内部错误
)

type Result struct {
	Success bool   `json:"success"`
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

func GenSuccessResult(data any) Result {
	return Result{
		Success: true,
		Code:    Success,
		Data:    data,
	}
}

func GenFailResult(message string) Result {
	return Result{
		Success: false,
		Code:    Fail,
		Message: message,
	}
}
